package org.example;

import org.example.entity.Person;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.task.TaskExecutor;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @description: 用户线程与守护线程
 */
@SpringBootTest
public class ExampleApplicationTest4 {


    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()->{
            System.out.println("t1 isDaemon：" + Thread.currentThread().isDaemon());
            new Thread(()->{
                System.out.println("t2 isDaemon：" + Thread.currentThread().isDaemon());
            }, "t2").start();
        }, "t1");
        thread.setDaemon(true);
        thread.start();
        System.out.println("主线程 isDaemon：" + Thread.currentThread().isDaemon());

        TimeUnit.SECONDS.sleep(2);
    }
}